{% extends 'TopxiaWebBundle::bootstrap-modal-layout.html.twig' %}

{% block title %}
{% if dictionaryItem|default(false) %}{{ '更新字典'|trans }}
{% else %}{{ '添加字典'|trans }}
{% endif %}
{% endblock %}

{% block body %}
<div id="dictionary-creater-widget">

	<form id="dictionary-form" class="form-horizontal" {% if dictionaryItem|default() %}action="{{ path('admin_dictionary_edit',{id:dictionaryItem.id}) }}"{% else %}action="{{ path('admin_dictionary_create',{type:type}) }}"{% endif %} method="post" {% if dictionaryItem|default(false) %}data-flag="edit"{% else %}data-flag="add"{% endif %}>
		<div class="form-group">
			<label class="col-md-2 control-label" for="dictionary-name-field">{{ '名称'|trans }}</label>
			<div class="col-md-8 controls">
				<input class="form-control" id="dictionary-name-field" type="text" data-url="{{ path('admin_dictionary_name_check',{id:dictionaryItem.id|default(0)}) }}" name="name" value="{{ dictionaryItem.name|default() }}" tabindex="1">
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-2 control-label" for="dictionary-weight-field">{{ '显示序号'|trans }}</label>
			<div class="col-md-8 controls">
				<input class="form-control" id="dictionary-weight-field" type="text" name="weight" value="{{ dictionaryItem.weight|default(0) }}" tabindex="2">
				<div class="help-block">{{ '显示序号需为整数，分类按序号的顺序从小到大排序。'|trans }}</div>
			</div>
		</div>

		<input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
	</form>
</div>
<script type="text/javascript"> app.load('dictionary/save-modal') </script>
{% endblock %}

{% block footer %}
	
  	<button type="button" class="btn btn-link" data-dismiss="modal" tabindex="6">{{ '取消'|trans }}</button>
	<button id="dictionary-create-btn" data-submiting-text="{{ '正在提交'|trans }}" type="submit" class="btn btn-primary" data-toggle="form-submit" data-target="#dictionary-form" tabindex="4">{{ '保存'|trans }}</button>
{% endblock %}